@include('admin.header')
  <body>
    <div class="wallect-wrapper">
      <div class="item-wrap">
        <div class="item-title">转出钱包信息</div>
        <div class="item-desc"><span><a  id="choise_money">选择转出钱包</a></span></div>

        <ul class="list">
          <li>转出者编号：<span id="zhuanchuzhe"></span></li>
          <li>钱包编号：<span id="qianbao_h"></span></li>
          <li>转出者账号：<span id="zhuanchuname"></span></li>
          <li>钱包类型：
          <span id="purse_type">
          <!--
              @if($data && $data->pursetype == 0)
              <span>None</span>
              @elseif($data && $data->pursetype == 1)
                  <span>收益账户</span>
              @elseif($data && $data->pursetype == 2)
                  <span>现金账户</span>
              @elseif($data && $data->pursetype == 3)
                  <span>积分账户</span>
              @elseif($data && $data->pursetype == 4)
                  <span>o2o收益账户</span>    
              @elseif($data && $data->pursetype == 96)
                  <span>过账账户</span>    
              @elseif($data && $data->pursetype == 97)
                  <span>授信账户</span>    
              @elseif($data && $data->pursetype == 98)
                  <span>中央银行账户</span>            
              @else
                  <span>系统收益账户</span>    
              @endif
              -->

          </span>

          </li>
          <li>转出者类型：
          <span id="zhuanchu_type">
          <!--
            @if($data && $data->ownertype == 0)
              <span>None</span>
            @elseif($data && $data->ownertype == 1)
                <span>用户账户</span>
            @elseif($data && $data->ownertype == 2)
                <span>商家账户</span>
            @elseif($data && $data->ownertype == 3)
                <span>企业账户</span>
            @else
                <span>系统账户</span>    
            @endif
            -->
          </span>
          </li>
          <li>货币单位：<span id="huobi_danwei"></span></li>
          <li>转出者姓名：<span id="zhuanchu_name"></span></li>
          <li>余额：<span id="yue"></span></li>
          <li>最小金额：<span id="min_money"></span></li>
          <li>子钱包编号：<span id="zi_bianhao"></span></li>
          <li>冻结金额：<span id="dong_jie"></span></li>
          <li>创建时间：<span id="crea_time"></span></li>
        </ul>
      </div>
      <div class="item-wrap">
        <div class="item-title">转入钱包信息</div>
        <div class="item-desc"><span><a  id="choise_intomoney">选择转入钱包</a></span></div>
        <ul class="list">
          <li>转入者编号：<span id="zhuanruzhe"></span></li>
          <li>钱包编号：<span id="zr_qianbaobianhao">{{$data->purseid or ''}}</span></li>
          <li>转入者账号：<span id="zr_nodecode"></span></li>
          <li>钱包类型：
            <span id="zr_purse_type">
           <!--    @if($data && $data->pursetype == 0)
           <span>None</span>
           @elseif($data && $data->pursetype == 1)
               <span>收益账户</span>
           @elseif($data && $data->pursetype == 2)
               <span>现金账户</span>
           @elseif($data && $data->pursetype == 3)
               <span>积分账户</span>
           @elseif($data && $data->pursetype == 4)
               <span>o2o收益账户</span>    
           @elseif($data && $data->pursetype == 96)
               <span>过账账户</span>    
           @elseif($data && $data->pursetype == 97)
               <span>授信账户</span>    
           @elseif($data && $data->pursetype == 98)
               <span>中央银行账户</span>            
           @else
               <span>系统收益账户</span>    
           @endif -->
          </span>

          </li>
          <li>转入者类型：
           <span id="zr_zhuanchu_type">
           <!--  @if($data && $data->ownertype == 0)
             <span>None</span>
           @elseif($data && $data->ownertype == 1)
               <span>用户账户</span>
           @elseif($data && $data->ownertype == 2)
               <span>商家账户</span>
           @elseif($data && $data->ownertype == 3)
               <span>企业账户</span>
           @else
               <span>系统账户</span>    
           @endif -->
          </span>

          </li>
          <li>货币单位：<span id="zr_huobi_danwei"></span></li>
          <li>转入者姓名：<span id="zr_nodename"></span></li>
          <li>余额：<span id="zr_yue"></span></li>
          <li>最小金额：<span id="zr_jine"></span></li>
          <li>子钱包编号：<span id="zr_zibianbao"></span></li>
          <li>冻结金额：<span id="zr_dongjie"></span></li>
          <li>创建时间：<span id="zr_create_time"></span></li>
        </ul>
      </div>
      <form  method="post" class="js-ajax-tree js-category-add">
      <div class="item-wrap w100">
        <div class="item-title">转账信息</div>
        <ul class="list">
          <li>转出钱包编号：<input type="text" style="width: 150px;height: 30px;" name="out_purse_id" id="out_purse_id" value=""/></li>
          <li>转出金额：<input type="text" style="width: 150px;height: 30px;" name="amount" value=""/></li>
          <li>转入钱包编号：<input type="text" style="width: 150px;height: 30px;" name="into_purse_id" id="into_purse_id" value=""/></li>
          <li>转账原因：
          <select name="reason" id="reason">
          <option value="">--请选择--</option>
          @foreach($resonlist as $v)
           <option value="{{$v->reson_id}}">{{$v->reson_name}}</option>
          @endforeach
          </select>
          </li>
          <li>转账安全码：<input type="text" style="width: 150px;height: 30px;" name="safety_code" value=""/>&nbsp;&nbsp;<span style="color:red;">验证码格式为：当前登录账号_当前日期(例如：年-0月-0日)</span></li>
          <li>转账备注：<textarea name="remark" ></textarea></li>
        </ul>
        <input type="submit" class="btn btn-primary" value="转账" />
      </div>
      </form>
    </div>
    <input type="hidden" name="purseid" id="purseid"/>
    <input type="hidden" name="pursetypeName" id="pursetypeName"/>
    <input type="hidden" name="bianhao" id="bianhao"/>
    <input type="hidden" name="unodecode" id="unodecode"/>
    <input type="hidden" name="unodename" id="unodename"/>
    <input type="hidden" name="zhanghutype" id="zhanghutype"/>
    <input type="hidden" name="zizhanghu" id="zizhanghu"/>
    <input type="hidden" name="zhanghuyu" id="zhanghuyu"/>
    <input type="hidden" name="minyue" id="minyue"/>
    <input type="hidden" name="dongjieyue" id="dongjieyue"/>
    <input type="hidden" name="keyongyu" id="keyongyu"/>
    <input type="hidden" name="huobidanww" id="huobidanww"/>
    <input type="hidden" name="ctime" id="ctime"/>
  </body>
  <script type="text/javascript" src="/static/js/common.js"></script>
  <script type="text/javascript" src="/static/js/validate/validate.js"></script>
  <script type="text/javascript" src="/static/js/layer/layer.js"></script>
<script>
$(function(){
   $('#choise_money').click(function() {
      // open_iframe_layer('/capital/choise_outmoney');
      layer.open({
        type: 2,
        area: ['1200px', '700px'],
        content: '/capital/choise_outmoney', //数组第二项即吸附元素选择器或者DOM
        end: function(){
          //下周一开发思路：要获取选中得所有值,然后传给读页面直接用$('#ceshi').html(id)读出来，不用刷新页面;

          $('#zhuanchuzhe').html($('#bianhao').val());
          $('#qianbao_h').html($('#purseid').val());
          $('#zhuanchuname').html($('#unodecode').val());
          $('#purse_type').html($('#pursetypeName').val());
          $('#zhuanchu_type').html($('#zhanghutype').val());
          $('#huobi_danwei').html($('#huobidanww').val());
          $('#zhuanchu_name').html($('#unodename').val());
          $('#yue').html($('#zhanghuyu').val());
          $('#min_money').html($('#minyue').val());
          $('#zi_bianhao').html($('#zizhanghu').val());
          $('#dong_jie').html($('#dongjieyue').val());
          $('#crea_time').html($('#ctime').val());
          $('#out_purse_id').val($('#purseid').val());







          //window.location.href="/capital/account_transfer?id="+id;
        }
      });
    });
    $('#choise_intomoney').click(function() {
      //open_iframe_layer('/capital/choise_outmoney');
      layer.open({
        type: 2,
        area: ['1200px', '700px'],
        content: '/capital/choise_outmoney', //数组第二项即吸附元素选择器或者DOM
        end: function(){
          $('#zhuanruzhe').html($('#bianhao').val());
          $('#zr_qianbaobianhao').html($('#purseid').val());
          $('#zr_nodecode').html($('#unodecode').val());
          $('#zr_purse_type').html($('#pursetypeName').val());
          $('#zr_zhuanchu_type').html($('#zhanghutype').val());
          $('#zr_huobi_danwei').html($('#huobidanww').val());
          $('#zr_nodename').html($('#unodename').val());
          $('#zr_yue').html($('#zhanghuyu').val());
          $('#zr_jine').html($('#minyue').val());
          $('#zr_zibianbao').html($('#zizhanghu').val());
          $('#zr_dongjie').html($('#dongjieyue').val());
          $('#zr_create_time').html($('#ctime').val());
          $('#zr_create_time').html($('#ctime').val());
          $('#into_purse_id').val($('#purseid').val());

         // window.location.href="/capital/intoaccount_transfer?id="+id;
        }
      });
    });

      $(".js-category-add").validate({
        rules: {
          amount : {
                    required    : true
                },
          safety_code : {
                    required    : true
                },
          out_purse_id : {
                    required    : true
                },
          into_purse_id : {
                    required    : true
                }      
          
        },
        messages: {
          amount: {
            required: "转出金额不能为空"
          },
           safety_code: {
            required: "安全码不能为空"
          },
           out_purse_id: {
            required: "请选择转出钱包编号"
          },
           into_purse_id: {
            required: "请选择转入钱包编号"
          }
        },
        submitHandler: function () {
          $.post("/capital/doTransfer",$('.js-category-add').serialize(), function (msg) {
            if (msg.status == 1) {
              layer.confirm(msg.info, {
                btn: ['确定']
              }, function(){
                window.location.href="{{asset('capital/account_transfer')}}";
              });
            } else {
              showMsg(msg.info);
            }
          }, 'json');
          return false;
        }
      });


});
    /**
     * layer提示
     */
    function showMsg(msg){
      layer.alert(msg, {
        title: '提示',
        icon: 2,
      });
    }

</script>